<!DOCTYPE html>
<html>
<head>
<title>Signin</title>
<link href="__CSS__/style.css" rel='stylesheet' type='text/css' />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="App Sign in Form,Login Forms,Sign up Forms,Registration Forms,News latter Forms,Elements"./>
</script>

</head>
<body>
    <h1>Exam System</h1>
        <div class="app-cam">
            <div class="cam"><img src="__IMG__/cam.png" class="img-responsive" alt="" /></div>
            <div>
                <input type="text" class="text" name="uname" id="uname" placeholder="用户名" >
                <input type="password" name="pwd" id="pwd" placeholder="密码">
                <div class="submit"><input type="submit" onclick="login();" value="登录" ></div>
                <div class="clear"></div>
                <!-- <div class="buttons">
                    <ul>
                        <li><a href="#" class="hvr-sweep-to-right">Sign in with Facebook</a></li>
                        <li><a href="#" class="hvr-sweep-to-left">Sign in with Twitter</a></li>
                        <div class="clear"></div>
                    </ul>
                </div> -->
                <div class="new">
                    <p><a href="">忘记密码 ?</a></p>
                    <p class="sign"><if condition="$from eq 'index'"><a href="{:U('register')}"> 注册</a></if></p>
                    <div class="clear"></div>
                </div>
            </div>
        </div>
    <!--start-copyright-->
        <div class="copy-right">
                <p></p>
        </div>
    <!--//end-copyright-->
<script>
function login() {
	var uname = $("#uname").val();
	var pwd = $("#pwd").val();
	if (uname == '') {
		alert("用户名不能为空");
		return false;
	} else if (pwd == '') {
		alert("密码不能为空");
		return false;
	}
	$.post("{:U('loginCheck')}",{uname:uname,pwd:pwd,from:'{$from}'},function(msg){
		if (msg.status == 1) {
			if ('{$from}' == 'admin') {
				location.href = "{:U('/Home/Admin/paperList')}";
			} else {
				location.href = "{:U('/Home/Index')}";
			}
		} else {
			alert(msg.error);
		}
	});
}
</script>
<script src="__STATIC__/jquery-1.9.1.min.js"></script>
</body>
</html>